home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.constraints;
-
- import sub_arctic.lib.interactor;
-
- import java.util.Vector;
-
- /**
- * Interface for objects that provide an implementation for constraints.
- * These object understand how to encode and decode an integer encoding of
- * a constraint (or maintain such a coding inside themselves), and use that
- * to perform operations such as evaluate the constraint, determine if it
- * depends upon a particular value, produce a human readable rendition of
- * the constraint, etc. <p>
- *
- * For constraint implementations that do not encode the constraints inside
- * the object, there is typically only one instance of each constraint
- * implementation which is shared by all constraints encoded in the same form
- * (this is true for example of std_constraint_impl).<p>
- *
- * @see constraints.std_constraint_impl
- * @author Scott Hudson
- */
- public interface constraint_impl {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Create a human readable string corresponding to the given constraint
- * encoding.
- *
- * @param int enc the constraint encoding
- * @param int orient the orientation of the constraint
- * @return String a human readable string for the constraint
- */
- public String str_for(int enc, int orient);
-
- /**
- * Create a terse human readable string corresponding to the given constraint
- * encoding.
- *
- * @param int enc the constraint encoding
- * @param int orient the orientation of the constraint
- * @return String a human readable string for the constraint
- */
- public String tag_for(int enc, int orient);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Determine if a given constraint encoding represents "none" (i.e., that
- * no constraint is to be applied).<p>
- *
- * @param int enc the encoding for the constraint.
- * @return boolean true if the encoding represents "none"
- */
- public boolean is_none(int enc);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Determine if a given constraint encoding represents an external
- * (aka heavyweight) constraint.<p>
- *
- * @param int enc the encoding for the constraint.
- * @return boolean true if the encoding indicates an external constraint
- */
- public boolean is_external(int enc);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Evaluate an encoded constraint (under a given orientation). The
- * constraint is being applied to the given part of the given object (i.e.
- * the constr_part part of the constr_obj object). The encoding typically
- * will designate parameter values relative to that object (i.e. the width
- * of the parent of the object). <p>
- *
- * @param int enc the encoding of the constraint
- * @param interactor constr_obj the object being constrained
- * @param int constr_part the part being constrained
- * @param int orient the orientation of the constraint
- * @return int the result of the evaluation
- */
- public int eval(
- int enc,
- interactor constr_obj,
- int constr_part,
- int orient);
-
- //had:
- //* @exception bad_value if the encoding, or constrained object/part are
- //* malformed
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Test whether the given encoded constraint depends on the indicated
- * neighboring object and part. The constraint is attached to the
- * constr_obj object and this test is expressed relative to that object.
- * The object and part that we determine dependency upon is encoded in
- * test_which_obj and test_which_part. For tests of child objects, an
- * indication of the index of that child is also given.<p>
- *
- * If this is an "external" constraint that maintains its own dependency
- * edges and works through the external notification system, then this
- * method may safely return false in all cases. <p>
- *
- * @param int enc The encoding for the constraint.
- * @param interactor constr_obj The object the constraint is attached to
- * @param int test_which_obj The neighboring object we are asking
- * about. This can be one of the values
- * OBJCODE_SELF, OBJCODE_PARENT,
- * OBJCODE_SOME_CHILD,
- * OBJCODE_PREV_SIBLING, or
- * OBJCODE_NEXT_SIBLING.
- * @param int test_which_part The part we are asking about.
- * @param int nth_child for SOME_CHILD, this provides the index
- * of the child (and is ignored otherwise).
- * @param int orient Orientation of the constraint. This
- * should be HORIZONTAL or VERTICAL.
- * @return boolean whether the given constraint depends upon the given value
- */
- public boolean depends_on(
- int enc,
- interactor constr_obj,
- int which_obj,
- int which_part,
- int nth_child,
- int orient);
-
- //had:
- //* @exception bad_value if one of the parameters has an unrecognized value
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Extract the set of objects/parts that a constraint depends on. This
- * produces a Vector with pairs of entries, the first being an interactor,
- * and the second being an Integer which is the part number of that
- * interactor that is depended upon.<p>
- *
- * @param int enc encoding value for the constraint in question.
- * @param interactor constr_obj the object the constraint is attached to
- * (hence its referents are relative to).
- * @param int orient Orientation of the constraint. This
- * should be HORIZONTAL or VERTICAL.
- * @return Vector containing pairs of objects, the first being an interactor
- * which is depended upon, and the second being an Integer
- * giving the part number of the part depended upon.
- */
- public Vector depend_list(int enc, interactor constr_obj, int orient);
-
- //had:
- //* @exception bad_value if the encoding value is not valid.
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Extract the dependencies that are implicit in the particular operation
- * encoded in the given standard constraint encoding. <p>
- *
- * @param int enc encoding value for the constraint in question.
- * @param interactor constr_obj the object the constraint is attached to
- * (hence its referents are relative to).
- * @param int orient Orientation of the constraint. This
- * should be HORIZONTAL or VERTICAL.
- * @return Vector containing pairs of objects, the first being an interactor
- * which is depended upon, and the second being an Integer
- * giving the part number of the part depended upon.
- */
- public Vector implicit_depend_list(int enc, interactor constr_obj,int orient);
-
- //had:
- //* @exception bad_value if the encoding value is not valid.
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-